import Mock from 'mockjs'

const list = Mock.mock({
  'list|10': [{
    'childrens|5': [{
      'childrens|5': [
        {
          'craftList|2': [
            {
              'craftId': '@id',
              'craftName': '@cname',
              'craftNodeId': '@id()',
              'nodeId': '@id',
              'nodeName': '@cname'
            }
          ],
          'nodeId': '@id',
          'nodeLev|+1': 0,
          'nodeModelLabel': '',
          'nodeName': '@cname',
          'nodeSort|+1': 0,
          'parentId': '@id()',
          'price|200-1000': 200,
          'remark': '@ctitle',
          'unit|1': ['秒', '分', '时'],
          'workHour|1-24': 1
        }
      ],
      'craftList|2': [
        {
          'craftId': '@id',
          'craftName': '@cname',
          'craftNodeId': '@id()',
          'nodeId': '@id',
          'nodeName': '@cname'
        }
      ],
      'nodeId': '@id',
      'nodeLev|+1': 0,
      'nodeModelLabel': '',
      'nodeName': '@cname',
      'nodeSort|+1': 0,
      'parentId': '@id()',
      'price|200-1000': 200,
      'remark': '@ctitle',
      'unit|1': ['秒', '分', '时'],
      'workHour|1-24': 1
    }],
    'craftList|5': [{
      'craftId': '@id',
      'craftName': '@cname',
      'craftNodeId': '@id()',
      'nodeId': '@id',
      'nodeName': '@name'
    }],
    'nodeId': '@id',
    'nodeLev|+1': 0,
    'nodeModelLabel': '标签',
    'nodeName': '@cname',
    'nodeSort|+1': 0,
    'parentId': '@id()',
    'price|200-1000': 200,
    'remark': '@ctitle',
    'unit|1': ['秒', '分', '时'],
    'workHour|1-100': 1
  }]

})

const dictMap = {

}
const pub = {
  isMore: 0,
  pageIndex: 1,
  pageSize: 10,
  startIndex: 0,
  totalNum: 30,
  totalPage: 1
}
export default [
  // 分页查询任务节点模板
  {
    url: '/task/taskNodeModel/listTaskNodelModelByPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 新增任务节点模板
  {
    url: '/task/taskNodeModel/addTaskNodeModel',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: '添加成功'
      }
    }
  },
  //   根据ID删除任务节点模板
  {
    url: '/task/taskNodeModel/deleteTaskNodeModelById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  //  分页查询任务节点模板
  {
    url: '/task/taskNodeModel/listTaskNodelModelByPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        msg: ''
      }
    }
  },
  //   修改任务节点模板
  {
    url: '/task/taskNodeModel/modifyTaskNodeModel',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  //   树形结构展示任务节点模板
  {
    url: '/task/taskNodeModel/treeTaskNodelModel',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: [...list.list],
        dictMap,
        msg: ''
      }
    }
  },
  //   根据ID查询任务节点模板
  {
    url: '/task/taskNodeModel/viewTaskNodeModelById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: {
          ...list.list[0],
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  }

]
